// foreach.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class PrintInt
{
public:
	void operator() (int elem) const 
	{
		cout << elem << " ";
	}
};

int _tmain(int argc, _TCHAR* argv[])
{
	vector <int> coll;
	for (int i=1; i<=9; ++i)
	{
		coll.push_back(i);
	}

	for_each(coll.begin(), coll.end(), PrintInt());
	
	cout << endl;
	cin.get();
	return 0;
}

